package tasknow.testdriver;

import static org.junit.Assert.*;

import org.junit.Test;

import tasknow.parser.Parser;
import tasknow.utils.Constants;
import tasknow.utils.Task;

public class ClassTest {

	// @author A0096638M

	@Test
	public void test() {
		// Test case for a Task with Description, Start Date&Time, End Date&Time
		//The input month for parseToFullCalendarFormat is in the Gregorian Calendar object format
		// i.e. 00 = January, 01 = February

		Task task1 = new Task("task1",
				Parser.parseToFullCalendarFormat("010314 1111"),
				Parser.parseToFullCalendarFormat("020314 2222"));

		assertEquals(task1.getDescription(), "task1");
		assertEquals(task1.getStartDateString(), "01/04/14");
		assertEquals(task1.getStartTimeString(), "11:11");
		assertEquals(task1.getEndDateString(), "02/04/14");
		assertEquals(task1.getEndTimeString(), "22:22");
		assertEquals(task1.isCompleted(), Constants.INCOMPLETE);
		task1.mark();
		assertEquals(task1.isCompleted(), Constants.COMPLETE);

		// Test case for a Task with Description, Start Date, End Date&Time
		Task task2 = new Task("task2",
				Parser.parseToFullCalendarFormat("030314"),
				Parser.parseToFullCalendarFormat("040314 2121"));

		assertEquals(task2.getDescription(), "task2");
		assertEquals(task2.getStartDateString(), "03/04/14");
		assertEquals(task2.getStartTimeString(), Constants.NO_START_TIME);
		assertEquals(task2.getEndDateString(), "04/04/14");
		assertEquals(task2.getEndTimeString(), "21:21");

		// Test case for a Task with Description, End Date&Time
		Task task3 = new Task("task3", null,
				Parser.parseToFullCalendarFormat("050314 1212"));

		assertEquals(task3.getDescription(), "task3");
		assertEquals(task3.getStartDateString(), Constants.NO_START_DATE);
		assertEquals(task3.getStartTimeString(), Constants.NO_START_TIME);
		assertEquals(task3.getEndDateString(), "05/04/14");
		assertEquals(task3.getEndTimeString(), "12:12");

		// Test case for a Task with Description, End Date
		Task task4 = new Task("task4", null,
				Parser.parseToFullCalendarFormat("060300"));

		assertEquals(task4.getDescription(), "task4");
		assertEquals(task4.getStartDateString(), Constants.NO_START_DATE);
		assertEquals(task4.getStartTimeString(), Constants.NO_START_TIME);
		assertEquals(task4.getEndDateString(), "06/04/00");
		assertEquals(task4.getEndTimeString(), Constants.NO_END_TIME);
		assertEquals(task4.getTaskStatusString(), Constants.STRING_OVERDUE);

		// Task case for a Task with just description
		Task task5 = new Task("task5", null, null);

		assertEquals(task5.getDescription(), "task5");
		assertEquals(task5.getStartDateString(), Constants.NO_START_DATE);
		assertEquals(task5.getStartTimeString(), Constants.NO_START_TIME);
		assertEquals(task5.getEndDateString(), Constants.NO_END_DATE);
		assertEquals(task5.getEndTimeString(), Constants.NO_END_TIME);
	}

}
